using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Collections.Generic;
using System.Text;

using System.Text.RegularExpressions;

namespace OgilvyOne.Utility
{
    public class DownLoadUtil: System.Web.UI.Page
    {
        //public static string DownFileWithStream(string filename)
        //{
        //    //string returnvalue = "";
        //    string filepath = "/pub/crm/uploadfiles/";
        //    long ImageSize;
        //    byte[] ImageBuffer;
        //    string sfilename = System.Web.HttpUtility.UrlDecode(filename);
        //    string sPath = Server.MapPath(filepath + sfilename);
        //    System.IO.FileInfo file = new System.IO.FileInfo(sPath);
        //    ImageSize = file.Length;

        //    FileStream fs = new FileStream(sPath, FileMode.OpenOrCreate);
        //    BinaryReader r = new BinaryReader(fs);
        //    r.BaseStream.Seek(0, SeekOrigin.Begin);
        //    ImageBuffer = r.ReadBytes(Int32.Parse(ImageSize.ToString()));
        //    sfilename = System.Web.HttpUtility.UrlEncode(System.Text.Encoding.UTF8.GetBytes(sfilename));
        //    Response.Clear();
        //    Response.ContentType = "application/octet-stream";
        //    Response.AddHeader("Content-Disposition", "attachment;filename=" + sfilename);
        //    Response.BinaryWrite(ImageBuffer);
        //    fs.Close();
        //}
    }
}
